package text111;

import java.util.Stack;

public class Solution {
	public int[] reversePrint(ListNode head) {
		//建栈，链表元素入栈
		Stack<Integer>A = new Stack<Integer>();
		while(head!=null) {
			A.add(head.val);
			head = head.next;
		}
		int size = A.size();
		//出栈
		int num[] = new int[size];
		for (int i = 0; i < num.length; i++) {
			num[i] = A.pop();
		}
		
		return num;

	    }
}
